<?php
/**
 * Created by PhpStorm.
 * User: admin
 * Date: 2021.3.19
 * Time: 16:35
 */

interface Animal {

}

class Dog implements Animal {
    protected $color;

    public function __construct($color = 'black')
    {
        $this->color = $color;
    }
}


$reflector = new ReflectionClass(Dog::class);

$isInitial = $reflector->isInstantiable();
if($isInitial) {
    $constructor = $reflector->getConstructor();
    if(!is_null($constructor)) {
        $parameters = $constructor->getParameters();
        foreach ($parameters as $parameter) {
            $newReflector = new ReflectionClass($parameter);
            $newIsInital = $newReflector->isInstantiable();
            $newContructor= $newReflector->getConstructor();
            $newContructorParamerters= $newContructor->getParameters();
        }
    }
}
